﻿using System.Web;
using System.Web.Mvc;
using Sisocana.Core;
using Sisocana.Core.Interfaces;
using Sisocana.Core.Models;


namespace Sisocana.Seguridad
{
    public class AdminGralAuthorizeAttribute : AuthorizeAttribute
    {
        private ISecurity _security;

        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (!httpContext.User.Identity.IsAuthenticated || (httpContext.User.Identity.Name == null))
                return false;
            _security = new Security();
            return (_security.HasPermissionGralAdmin(httpContext.User.Identity.Name));
        }
    }
}